home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9171 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.9 KB  |  45 lines

  1. Path: anvil.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c++,comp.lang.c
  4. Subject: Re: Performance: C vs. C++
  5. Date: 27 Feb 1996 10:18:16 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4gvht8INNkbu@anvil.ugrad.cs.ubc.ca>
  8. References: <30F6BAAC.12B5@iastate.edu> <4fvr7k$a3l@stc06.ctd.ornl.gov> <4gqdo6INNsqe@keats.ugrad.cs.ubc.ca> <4guu1v$ie1@solutions.solon.com>
  9. NNTP-Posting-Host: anvil.ugrad.cs.ubc.ca
  10.  
  11. In article <4guu1v$ie1@solutions.solon.com>,
  12. Peter Seebach <seebs@solutions.solon.com> wrote:
  13.  >In article <4gqdo6INNsqe@keats.ugrad.cs.ubc.ca>,
  14.  >Kazimir Kylheku <c2a192@ugrad.cs.ubc.ca> wrote:
  15.  >>Boy, with all this obfuscation, you can almost forget that a pointer is just a
  16.  >>simple machine address! 
  17.  >
  18.  >No, it's a machine address or similar tag along with a knowledge of what kind
  19.  >of thing it points to.  Implementations exist where the conversion from a
  20.  >char * to a long * is a right-shift by 2.  Although it's not complete, I
  21.  
  22. Of course. But point to one implementation that will use such different
  23. representations between pointers to two different data structure types (not
  24. atomic types like char or long).
  25.  
  26. Having the type checking there is great, but too much abstraction is just,
  27. well, too much!
  28.  
  29.  >have a draft for an implementation where
  30.  >    main() {
  31.  >        int i, *ip = &i;
  32.  >    }
  33.  >leaves ip looking something like "pint, 0".
  34.  >
  35.  >(0 is not the null pointer internally in this implementation; it's used for
  36.  >the first object of a type.)
  37.  >(i is internally marked as being an int as well, so &i looks like "pint, 0",
  38.  >and the assignment is legal.  Assigning from most other pointer types without
  39.  >the required cast would generate a run-time fault.  ;))
  40.  
  41. But this kind of low level explanation is far removed from the original posting
  42. about lofty new pointer semantics.
  43. -- 
  44.  
  45.